<template>
  <div class="fawen-finish">
    <!-- <el-breadcrumb separator=">">
      <el-breadcrumb-item :to="{ path: '/' }">系统首页</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/selection' }">干部选任</el-breadcrumb-item>
      <el-breadcrumb-item>任职发文</el-breadcrumb-item>
    </el-breadcrumb> -->
    <section class="wboxnoborder">
      <!-- <div :style="'height:'+tableHeight+'px'">
        <el-scrollbar style="height: calc(100% + 16px); margin:15px">
          <h3>基本信息</h3>
          <div class="item">
            <div class="item-left">姓名</div>
            <div class="item-right">{{fdata.realName}}</div>
          </div>
          <div class="item">
            <div class="item-left">目前单位</div>
            <div class="item-right">{{fdata.candidateUnit}}</div>
          </div>
          <div class="item">
            <div class="item-left">目前职务</div>
            <div class="item-right">{{fdata.currentJob}}</div>
          </div>
          <div class="item">
            <div class="item-left">目前职级</div>
            <div class="item-right">{{fdata.currentLevel}}</div>
          </div>
          <div class="item">
            <div class="item-left">选任岗位单位</div>
            <div class="item-right">{{fdata.unitName}}</div>
          </div>
          <div class="item">
            <div class="item-left">选任岗位职务</div>
            <div class="item-right">{{fdata.jobName}}</div>
          </div>
          <div class="item">
            <div class="item-left">选任岗位职级</div>
            <div class="item-right">{{fdata.jobLevel}}</div>
          </div>
          <div class="line"></div>
          <h3>报中组部备案</h3> -->
          <div v-show="loading">加载中...</div>
          <el-form ref="form"
            v-show="!loading"
            label-width="150px"
            label-position="right">
            <el-form-item label="任职文号">
              <span class="selectioncontent">{{fdata.docno}}</span>
            </el-form-item>
            <el-form-item label="任职时间">
              <span class="selectioncontent">{{fdata.arrivalTime}}</span>
            </el-form-item>
            <el-form-item label="是否有试用期">
              <span class="selectioncontent">{{fsel[fdata.probationPeriod]}}</span>
            </el-form-item>
            <el-form-item label="部领导批示">
              <leaderOpinion :recordId="fdata.postDispatchBatchId" recordTable="bus_post_dispatch_batch" :leaderType="1" :canEdit="false"></leaderOpinion>
            </el-form-item>
            <el-form-item label="司领导批示">
              <leaderOpinion :recordId="fdata.postDispatchBatchId" recordTable="bus_post_dispatch_batch" :leaderType="2" :canEdit="false"></leaderOpinion>
            </el-form-item>
            <el-form-item label="附件">
              <div  v-for="(item, index) of fdata.files" :key="index">
                <a :href="$http.defaults.baseURL+$http.defaults.selectionAPI+'api/gen/file/download?id='+item.id">{{item.fileName}}.{{item.fileType}}</a>
              </div>
            </el-form-item>
          </el-form>
          <notice :noticePersonId="personId" :step="8"></notice>
          <!-- <el-button type="primary" @click="$router.push({path: '/selection/'})" style="margin:15px 150px">返回</el-button>
        </el-scrollbar>
      </div> -->
    </section>
  </div>
</template>

<script>
import notice from '../common/Notice'
import leaderOpinion from '../common/leaderOpinion'
export default {
  props: ['personId'],
  watch: {
    personId: {
      handler (val, oldVal) {
        console.log('newval:' + val)
        this.showFinishData(val)
      },
      immediate: true
    }
  },
  name: 'fawen-finish',
  data () {
    return {
      loading: false,
      fdata: {},
      fsel: ['否', '是'],
      fujianData: []
    }
  },
  components: {
    notice, leaderOpinion
  },
  // mounted () {
  //   // 获取完成data
  //   let pid = this.$route.params.id
  //   console.log('人选pid:', pid)
  //   this.personId = pid
  //   this.showFinishData(pid)
  //   // resize
  //   this.tableresize(this)
  //   let _this = this
  //   window.onresize = function windowResize () {
  //     // 通过捕获系统的onresize事件触发我们需要执行的事件
  //     _this.tableresize(_this)
  //   }
  // },
  methods: {
    showFinishData (pid) {
      this.loading = true
      let url = this.$http.defaults.selectionAPI + 'api/selection/postdispatch/getBatchByPerson'
      // console.log(url)
      this.$http.get(url, {
        params: {
          personId: pid
        }
      }).then(res => {
        this.loading = false
        console.log('get finish data succ:', res)
        if (res.data.success === true) {
          this.fdata = res.data.result
        } else {
          this.$message({
            message: '数据获取失败',
            type: 'error'
          })
        }
      })
    }
  }
}
</script>

<style>
.fawen-finish .el-form-item{
  margin-bottom:0;
}
.fawen-finish .wboxnoborder .el-table{
  border: #95B8E7 solid 1px;
}
.fawen-finish .wboxnoborder .el-table th{
  font-weight: normal;
  background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
  text-align: center;
  border-right: #95B8E7 solid 1px;
  border-bottom: #95B8E7 solid 1px;
  min-height: 30px;
  line-height:30px;
}
.fawen-finish .wboxnoborder .el-table td, .el-table th{
  padding:0;
  font-size:var(--size14) !important;
  line-height: 20px;
  font-family: '宋体';
  text-align: center;
}
.fawen-finish .el-table__row{
  height: 50px;
}
</style>
<style scoped>
.fawen-finish {
  width: 100%;
}
.tit {
  width: 100%;
  height: 40px;
  line-height: 40px;
  font-size: 16px;
}
.item {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
}
.item-left {
  width: 120px;
  text-align: right;
}
.item-right {
  width: 60%;
  margin-left: 15px;
  font-weight: bolder
}
.line {
  width: 100%;
  height: 1px;
  background-color: #74A6CC;
  margin-top: 20px;
}
.fawen-finish .wboxnoborder {
  padding: 0;
  width: 100%;
  background-color: #fff;
  margin: 0 10px;
  overflow: hidden;
}
</style>
